/**
 * 
 */
package com.axt.dbaudit.action.cfg;

import java.util.List;
import org.apache.struts2.json.annotations.JSON;

import com.axt.dbaudit.bean.cfg.TransDictBean;
import com.axt.dbaudit.model.cfg.TransDict;
import com.axt.soa.action.BaseAction;
import com.axt.soa.msg.types.MsgParam;

public class TransDictAction extends BaseAction{
	private TransDictBean transDictBean = new TransDictBean();
	private List<TransDict> transDicts = null;
	
	@JSON(name="transdicts")
	public List<TransDict> getTransDicts() {
		return transDicts;
	}
	public void setTransDicts(List<TransDict> transDicts) {
		this.transDicts = transDicts;
	}
	
	@JSON(name="errcode")
	public int getErrcode() {
		return errcode;
	}
	
	@JSON(name="errinfo")
	public String getErrinfo() {
		return errinfo;
	}
	
	
	private String au_eng;
	private String au_chi;
	/**
	 * @return the au_eng
	 */
	public String getAu_eng() {
		return au_eng;
	}
	/**
	 * @param au_eng the au_eng to set
	 */
	public void setAu_eng(String au_eng) {
		this.au_eng = au_eng;
	}
	/**
	 * @return the au_chi
	 */
	public String getAu_chi() {
		return au_chi;
	}
	/**
	 * @param au_chi the au_chi to set
	 */
	public void setAu_chi(String au_chi) {
		this.au_chi = au_chi;
	}
/**
 * 添加翻译字典信息
 */
	public String addTransDict()
	{
		TransDict transDict = new TransDict();
		transDict.setAu_eng(au_eng);
		transDict.setAu_chi(au_chi);
		
		transDictBean.add(serverPath, transDict);
		setErrcode(transDictBean.getErrcode());
		setErrinfo(transDictBean.getErrinfo());
		
		return MsgParam.SUCCESS;
	}
/**
 * 删除翻译字典信息 
 */
	public String deleteTransDict()
	{
		transDictBean.delete(serverPath, au_eng);
		setErrcode(transDictBean.getErrcode());
		setErrinfo(transDictBean.getErrinfo());
		
		return MsgParam.SUCCESS;
	}
/**
 * 获取翻译字典列表
 */
	public String queryTransDict()
	{
		setTransDicts(transDictBean.query(serverPath));
		setErrcode(transDictBean.getErrcode());
		setErrinfo(transDictBean.getErrinfo());
		
		return MsgParam.SUCCESS;
	}
/**
 * 修改字典信息
 */
	public String updateTransDict()
	{
		TransDict transDict = new TransDict();
		transDict.setAu_eng(au_eng);
		transDict.setAu_chi(au_chi);
		
		transDictBean.modify(serverPath, transDict);
		setErrcode(transDictBean.getErrcode());
		setErrinfo(transDictBean.getErrinfo());
		
		return MsgParam.SUCCESS;
	}
}
